package org.example.dialogue.service.impl;

import lombok.extern.slf4j.Slf4j;
import org.example.dialog.client.DialogFeignClient;
import org.example.dialogue.form.MessageForm;
import org.example.dialogue.pojo.Conversations;
import org.example.dialogue.vo.MessageVo;
import org.example.dialogue.service.DialogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author zqtao
 */
@Slf4j
@Service
public class DialogServiceImpl implements DialogService {

    @Autowired
    private DialogFeignClient dialogFeignClient;

    @Override
    public List<MessageVo> getMessage(List<MessageForm> messageForms, Long userId, Integer initValue) {
        return dialogFeignClient.getMessage(messageForms,userId,initValue).getData();
    }

    @Override
    public String saveMessage(Long userId) {
        return dialogFeignClient.saveMessage(userId).getData();
    }

    @Override
    public List<Conversations> getHistoryMessage(Long userId) {
        return dialogFeignClient.getHistoryMessage(userId).getData();
    }

    @Override
    public Integer initializeChat(Long userId) {
        return dialogFeignClient.initializeChat(userId).getData();
    }

    @Override
    public String deleteChat(Integer conversationId) {
        return dialogFeignClient.deleteChat(conversationId).getData();
    }
}
